import React from 'react';
import { Redirect } from "react-router-dom";

import YMine from '../pages/mine';
import YFriend from '../pages/friend';
import YDiscover from '../pages/discover';
import YRecommend from '../pages/discover/c-pages/recommend';
import YRanking from '../pages/discover/c-pages/ranking';
import YSongs from '../pages/discover/c-pages/songs';
import YDjradio from '../pages/discover/c-pages/djradio';
import YArtist from '../pages/discover/c-pages/artist';
import YAlbum from '../pages/discover/c-pages/album';

import YPlayer from '../pages/player';
//  Redirect 是重定向组件

const routes = [
    {
        path:'/',
        exact:true,
        render:()=>(
            <Redirect to="/discover"/>
        )
    },
    {
        path:'/discover',
        component:YDiscover,
        routes:[
            {
                path:'/discover',
                exact:true,
                render:()=>(
                    <Redirect to="/discover/recommend"/>
                )
            },
			{
			  path: "/discover/recommend",
			  component: YRecommend
			},
			{
			  path: "/discover/ranking",
			  component: YRanking
			},
			{
			  path: "/discover/songs",
			  component: YSongs
			},
			{
			  path: "/discover/djradio",
			  exact: true,
			  component: YDjradio
			},
			{
			  path: "/discover/artist",
			  component: YArtist
			},
			{
			  path: "/discover/album",
			  component: YAlbum
			},
			{
			  path: "/discover/player",
			  component: YPlayer
			}
        ]
    },
    {
        path:'/mine',
        component:YMine
    },
    {
        path:'/friend',
        component:YFriend
    }
];


export default routes